From a0c858f6bf6a10d9ce258c35741c7f5d9aa1ae23 Mon Sep 17 00:00:00 2001 From: "emellor@leeni.uk.xensource.com" Date: Wed, 30 Nov 2005 19:48:54 +0000 Subject: [PATCH] Miscellaneous tidying up, no semantic changes. Signed-off-by: Ewan Mellor --- tools/python/xen/xend/XendCheckpoint.py | 2 -- tools/python/xen/xend/XendProtocol.py | 8 ++++---- tools/python/xen/xend/XendRoot.py | 2 +- tools/python/xen/xend/server/netif.py | 4 ++-- tools/python/xen/xend/server/relocate.py | 1 - tools/python/xen/xend/tests/test_sxp.py | 4 ++-- tools/python/xen/xend/uuid.py | 10 +++++----- 7 files changed, 14 insertions(+), 17 deletions(-) diff --git a/tools/python/xen/xend/XendCheckpoint.py b/tools/python/xen/xend/XendCheckpoint.py index a50a7b2cff..06c51ee417 100644 --- a/tools/python/xen/xend/XendCheckpoint.py +++ b/tools/python/xen/xend/XendCheckpoint.py @@ -18,8 +18,6 @@ import xen.util.auxbin import xen.lowlevel.xc -from xen.xend.xenstore.xsutil import IntroduceDomain - from XendError import XendError from XendLogging import log diff --git a/tools/python/xen/xend/XendProtocol.py b/tools/python/xen/xend/XendProtocol.py index 503af1d38b..20b6149577 100644 --- a/tools/python/xen/xend/XendProtocol.py +++ b/tools/python/xen/xend/XendProtocol.py @@ -100,7 +100,7 @@ class XendClientProtocol: """ return self.xendRequest(url, "POST", args) - def handleStatus(self, version, status, message): + def handleStatus(self, _, status, message): """Handle the status returned from the request. """ status = int(status) @@ -114,8 +114,8 @@ class XendClientProtocol: """Handle the data returned in response to the request. """ if data is None: return None - type = self.getHeader('Content-Type') - if type != sxp.mime_type: + typ = self.getHeader('Content-Type') + if typ != sxp.mime_type: return data try: pin = sxp.Parser() @@ -205,5 +205,5 @@ class UnixXendClientProtocol(HttpXendClientProtocol): path = xroot.get_xend_unix_path() self.path = path - def makeConnection(self, url): + def makeConnection(self, _): return UnixConnection(self.path) diff --git a/tools/python/xen/xend/XendRoot.py b/tools/python/xen/xend/XendRoot.py index d94f63a58d..b61532737a 100644 --- a/tools/python/xen/xend/XendRoot.py +++ b/tools/python/xen/xend/XendRoot.py @@ -171,7 +171,7 @@ class XendRoot: v = self.get_config_value(name, val) try: return int(v) - except Exception, ex: + except Exception: raise XendError("invalid xend config %s: expected int: %s" % (name, v)) def get_xend_http_server(self): diff --git a/tools/python/xen/xend/server/netif.py b/tools/python/xen/xend/server/netif.py index 14b079fdbb..9269d83ae0 100644 --- a/tools/python/xen/xend/server/netif.py +++ b/tools/python/xen/xend/server/netif.py @@ -71,8 +71,8 @@ class NetifController(DevController): script = os.path.join(xroot.network_script_dir, sxp.child_value(config, 'script', xroot.get_vif_script())) - type = sxp.child_value(config, 'type') - if type == 'ioemu': + typ = sxp.child_value(config, 'type') + if typ == 'ioemu': return (None,{},{}) bridge = sxp.child_value(config, 'bridge') mac = sxp.child_value(config, 'mac') diff --git a/tools/python/xen/xend/server/relocate.py b/tools/python/xen/xend/server/relocate.py index c179eaf6f7..d4480f242e 100644 --- a/tools/python/xen/xend/server/relocate.py +++ b/tools/python/xen/xend/server/relocate.py @@ -16,7 +16,6 @@ # Copyright (C) 2005 XenSource Ltd #============================================================================ -import socket import sys import StringIO diff --git a/tools/python/xen/xend/tests/test_sxp.py b/tools/python/xen/xend/tests/test_sxp.py index b0200b72cc..aad8161f10 100644 --- a/tools/python/xen/xend/tests/test_sxp.py +++ b/tools/python/xen/xend/tests/test_sxp.py @@ -6,8 +6,8 @@ import xen.xend.sxp class test_sxp(unittest.TestCase): def testAllFromString(self): - def t(input, expected): - self.assertEqual(xen.xend.sxp.all_from_string(input), expected) + def t(inp, expected): + self.assertEqual(xen.xend.sxp.all_from_string(inp), expected) t('String', ['String']) t('(String Thing)', [['String', 'Thing']]) diff --git a/tools/python/xen/xend/uuid.py b/tools/python/xen/xend/uuid.py index c471067fdd..2bf514c67d 100644 --- a/tools/python/xen/xend/uuid.py +++ b/tools/python/xen/xend/uuid.py @@ -25,14 +25,14 @@ import commands import random -def getUuidUuidgen(random = True): +def getUuidUuidgen(randomly = True): """Generate a UUID using the command uuidgen. - If random is true (default) generates a random uuid. - If random is false generates a time-based uuid. + If randomly is true (default) generates a random uuid. + If randomly is false generates a time-based uuid. """ cmd = "uuidgen" - if random: + if randomly: cmd += " -r" else: cmd += " -t" @@ -42,7 +42,7 @@ def getUuidUuidgen(random = True): def getUuidRandom(): """Generate a random UUID.""" - return [ random.randint(0, 255) for i in range(0, 16) ] + return [ random.randint(0, 255) for _ in range(0, 16) ] #uuidFactory = getUuidUuidgen -- 2.30.2